﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Data.SqlClient;

namespace PRE.Report
{
    public partial class FrmReport_Bienlai : DevExpress.XtraEditors.XtraForm
    {
        public string _soHD;

        public FrmReport_Bienlai()
        {
            InitializeComponent();
        }

        private void FrmReport_Hoadon_Load(object sender, EventArgs e)
        {
            XRBienlai xr = new XRBienlai();
            xr.DataSource = LoadData();
            xr.DataBingdings();

            printControl1.PrintingSystem = xr.PrintingSystem;
            xr.CreateDocument();
        }

        private DataSet LoadData()
        {
            SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=QLTTNgoaiNgu;Persist Security Info=True;User ID=sa;Password=sa");
            conn.Open();
            SqlCommand cmd = new SqlCommand(@"Select SoHD,b.Hoten,b.Diachi,Ngaylap,Sotien,Ghichu From tb_Phieuthu a join tb_Hocvien b on a.MaHVID = b.MaHV Where SoHD = '"+_soHD+"' ", conn);
            DataSet ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(ds);
            return ds;
        }
    }
}